Conversation
- calculator.divide: throw on division by zero - string-utils: implement truncate (word-boundary, ellipsis in maxLength) and fix wordCount for consecutive whitespace - task-manager: implement remove, update, and sortBy - date-utils.formatRelative: fix off-by-one in days branch (round instead of floor) - validator: relax isEmail TLD quantifier; allow ports/localhost in isUrl All 60 tests pass; tsc --noEmit clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes all 16 previously failing tests pass (60/60 now green,
tsc --noEmitclean) by implementing missing functions and fixing edge-case bugs across the utility library. No test files modified, no new dependencies.Changes
Infinity/NaN).truncate(word-boundary cut,"..."counted towardmaxLength); fixedwordCountto collapse consecutive whitespace viatrim().split(/\s+/).remove(delegates toMap.delete),update(applies only defined fields), andsortBy(priority desc, createdAt asc with numeric-id tiebreak, status lifecycle order).Math.round(Math.abs(diffHours)/24)instead ofMath.floor); now also symmetric for future dates.isEmailTLD quantifier to{2,}(accepts.museumetc.); dropped the port clause fromisUrl(acceptshttp://localhost:3000).Verification
bun test→ 60 pass, 0 failbunx tsc --noEmit→ exit 0Assumptions
dividenow throwing on zero is a behavioural change required by the test; documented here as it affects callers relying onInfinity.truncateomits the ellipsis whenmaxLength <= 3(no room for it).Reviewer notes (non-blocking, out of test scope)
sortByhas no runtimedefaultguard — an out-of-union field would returnundefinedat runtime for JS callers (tsc-safe since the switch is exhaustive).update(id, { description: undefined })does not clear the field (uses!== undefinedguard).isUrlnow accepts internal hosts (localhost, link-local) — host allowlisting belongs at the call site if used to gate outbound fetches (SSRF consideration).🤖 Generated with QuantCode Agent